Step 3 of 4: Adding Code to the Application
In This Topic
In the previous steps you set up the application's user interface and added controls to your application. In this step you'll add code to your application to finalize it.
Complete the following steps:
- Select View | Code to switch to Code view.
- In Code view, add the following import statement to the top of the page:
C# |
Copy Code
|
using C1.Xaml;
|
- Create a MainPage_Loaded event handler and add it below the page constructor:
C# |
Copy Code
|
private void MainPage_Loaded(object sender, RoutedEventArgs e)
{
UpdateGradient();
}
|
- Add the following code just after the MainPage_Loaded event handler to update the gradient values:
C# |
Copy Code
|
private void UpdateGradient()
{
if (c1rs1 != null)
{
this.goldcol.Offset = this.c1rs1.LowerValue;
this.blackcol.Offset = this.c1rs1.UpperValue;
}
}
|
- Add code to the c1rs1_LowerValueChanged event handler so that it appears like the following:
C# |
Copy Code
|
private void c1rs1_LowerValueChanged(object sender, EventArgs e)
{
UpdateGradient();
}
|
- Add code to the c1rs1_UpperValueChanged event handler so that it appears like the following:
C# |
Copy Code
|
c1rs1_UpperValueChanged(object sender, EventArgs e)
{
UpdateGradient();
}
|
In this step you completed adding code to your application. In the next step you'll run the application and observe run-time interactions.